'use client';

import { Dialog, DialogContent, DialogTitle } from '@/components/ui/Dialog';
import { usePathname, useRouter } from 'next/navigation';
import CreateApp from '../../new/page';

export default function BackableDialog() {
  const router = useRouter();
  const pathname = usePathname();
  return (
    <Dialog
      open={pathname.startsWith('/dashboard/apps/new')}
      onOpenChange={() => {
        router.back();
      }}
    >
      <DialogTitle></DialogTitle>
      <DialogContent>
        <CreateApp />
      </DialogContent>
    </Dialog>
  );
}
